package com.pulaien.shop.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.pulaien.common.core.controller.BaseController;
import com.pulaien.common.core.domain.AjaxResult;
import com.pulaien.common.core.page.TableDataInfo;
import com.pulaien.system.domain.MembershipGuidelines;
import com.pulaien.system.service.IMembershipGuidelinesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 新会员指引Controller
 */
@RestController
@RequestMapping("/shop/membershipGuidelines")
@Api(tags = "MembershipGuidelinesController", description = "新会员指引")
public class ShopMembershipGuidelinesController extends BaseController
{
    @Autowired
    private IMembershipGuidelinesService membershipGuidelinesService;

    /**
     * 查询新会员指引列表
     */
    @ApiOperation(value = "新会员指引列表")
    @GetMapping("/list")
    public TableDataInfo list()
    {
        List<MembershipGuidelines> list = membershipGuidelinesService.list(new LambdaQueryWrapper<MembershipGuidelines>().eq(MembershipGuidelines::getDelFlag,"0").orderByDesc(MembershipGuidelines::getSortKey));
        return getDataTable(list);
    }

    /**
     * 获取新会员指引详情
     */
    @ApiOperation(value = "获取新会员指引详情")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(membershipGuidelinesService.getById(id));
    }
}
